package phi.game.ball.actors
{
	import Box2D.Collision.Shapes.b2PolygonShape;
	import Box2D.Collision.b2AABB;
	import Box2D.Common.Math.b2Transform;
	import Box2D.Common.Math.b2Vec2;
	
	import phi.engine.actors.ActorOptions;
	import phi.engine.actors.InteractiveActor;
	import phi.engine.actors.PolygonActor;
	import phi.engine.utils.PhiMathUtil;
	
	public class BuildingActor extends PolygonActor
	{
		// Hill asset
		[Embed(source="assets/assets.swf", symbol="Building")]
		protected var BuildingSprite :Class;
		
		public function BuildingActor()
		{
		}
		
		override protected function createCostume():void
		{
			costume = new BuildingSprite();
		}
		
		override protected function createBody():void
		{
			super.createBody();
			var aaBB :b2AABB = new b2AABB();
			body.GetFixtureList().GetShape().ComputeAABB( aaBB, new b2Transform() );
			
			costume.width  = PhiMathUtil.metersToPixels( aaBB.GetExtents().x ) * 2;
			costume.height = PhiMathUtil.metersToPixels( aaBB.GetExtents().y ) * 2;
			costume.x -= costume.width/2;
			costume.y -= costume.height/2;
		}
	}
}